<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CreateStatistics extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table = $this->table('statistics', ['comment' => '统计表']);
        $table->addColumn('case_id','integer',array('limit'=>11,'null' => true,'comment'=>'案件id'))
            ->addColumn('review_project_id', 'integer',array('limit' => 11,'null' => true, 'comment' => '复查项目id'))
            ->addColumn('review_project_cycle','string',array('limit'=>100,'default' => '','null' => true,'comment'=>'复查项目周期'))
            ->addColumn('user_id', 'integer',array('limit' => 11,'null' => true, 'comment' => '复查人id'))
            ->addColumn('community_id', 'integer',array('limit' => 11,'null' => true, 'comment' => '社区id'))
            ->addColumn('finish', 'integer',array('limit' => 11,'default' => 0, 'comment' => '已整改'))
            ->addColumn('unfinished', 'integer',array('limit' => 11,'default' => 0,  'comment' => '未整改'))
            ->addColumn('rebound', 'integer',array('limit' => 11,'default' => 0, 'comment' => '反弹'))
            ->addColumn('disqualification', 'integer',array('limit' => 11,'default' => 0, 'comment' => '不合格'))
            ->addTimestamps()
            ->addSoftDelete()
            ->create();
    }
}
